#ifndef JS_EDITOR_EXTENSION_HPP
#define JS_EDITOR_EXTENSION_HPP

#include "js_base.hpp"
#include "scripting/scripting_api.h"

class JsEditorExtension final : public IEditorScript, JsScriptBase
{
public:
    JsEditorExtension(EditorTarget type, std::string title, const std::string &script_path);
    ~JsEditorExtension();
    void execute(const void *arg) override;
    static IScript* create(EditorTarget target, std::string title, const std::string_view &code, const std::string &script_path);
private:
    bool compile(const std::string_view& code) const;
};

#endif /* JS_EDITOR_EXTENSION_HPP */
